package com.atguigu.spring.beans.factory;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 夏焰波
 * @date 2020-08-20 1:54
 */
//实例工厂的方法，需要先创建工厂的实例，再调用工厂的实例方法来返回bean的实例
public class InstanceCarFactory {
    private Map<String, Car> cars = null;

    public InstanceCarFactory() {
        cars = new HashMap<>();
        cars.put("audi", new Car("audi", 30000));
        cars.put("ford", new Car("ford", 40000));
    }

    public Car getCar(String brand) {
        return cars.get(brand);
    }

}
